﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="View.aspx.cs" Inherits="JKF.Web.Customer.Swing_Card.View" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
        <%= RegScript("~/js/jquery.1.5.js")%>
        <%= RegScript("~/js/jquery.nhis.js")%>
        <%= RegScript("~/js/jquery.rchis.js")%>
        <%= RegScript("~/js/jquery-ui-custom.min.js")%>
        <%= RegScript("~/js/css.js")%>
        <%= RegScript("~/js/DatePicker/WdatePicker.js")%>
        <%= RegScript("~/js/Common.js")%>
        <%= RegScript("~/js/Jquery.commonGrid.js")%>
        <%= RegScript("~/js/jquery-form.js") %>
        <script src="../../js/Uppop/tipswindown2.js"  type="text/javascript"></script>

        <link href="../../App_Themes/Theme2/Include.css"   rel="stylesheet" type="text/css" />
          <script type="text/javascript">
              var isView = '<%=IsView%>'; //是否有浏览权限
              var isAdd = '<%=IsAdd%>' == 'True' ? '' : 'none'; //是否具有添加权限
              var isEdit = '<%=IsEdit%>' == 'True' ? '' : 'none'; //是否具有编辑权限
              var isDelete = '<%=IsDelete%>' == 'True' ? '' : 'none'; // 是否具有删除权限

              var AppPath = '<%=AppPath %>';
              var handler = AppPath + '/do/Other/SWING_CARD.do';
              var PageSize = 20;
              var shops = <%=Shops%>;
              var pager = null;
              $(function () {
                  pager = $('#divPager').pager(AppPath, handler, function () {
                      return { ActionName: 'GetSwingCard', searchItem: $('#dropSearchItem').val(),
                       matchWay: $('#dropMatchWay').val(), keyword: $('#txt_keyword').val(),
                        dateStart: $('#txt_CREATE_START').val(), dateEnd: $('#txt_CREATE_END').val(),
                        ownShop:$.FxNull($("#ownShop").attr("codes"), "") };
                  }, function (data) {
                      var tbody = $('#tb tbody');
                      tbody.empty();
                      if (data && data.Entity && data.Entity.length) {
                          data = data.Entity
                          var tr, td;
                          for (var i = 0; i < data.length; i++) {
                              var item = data[i];
                              tr = $("<tr key=" + item.ID + "></tr>").appendTo(tbody);
                              $('<td></td>').appendTo(tr).html('<input style="display:' + isDelete + '" type="button" class="common_btn_del mr12"  onclick="deleteSwing(' + "'" + item.ID + "'" + ')">');
                              $('<td></td>').appendTo(tr).text(item.CARD_NO);
                              $('<td></td>').appendTo(tr).text(item.NAME);
                              $('<td></td>').appendTo(tr).text(item.MOBILE);
                              $('<td></td>').appendTo(tr).text(item.TYPE);
                              $('<td></td>').appendTo(tr).text(item.TRY_TIME);
                              $('<td></td>').appendTo(tr).text(item.POINT_VALUE);
                              //$('<td></td>').appendTo(tr).text(item.TOTAL_POINT);
                              $('<td></td>').appendTo(tr).text(item.ACCOUNT);
                          }
                      } else {
                          tbody.html('<tr><td id="emptyTr" colspan="9" style="text-align: center">没有数据!</td></tr>');
                      }
                      var tbHeight = $(window).height() - $(".common_search").height() - $("#divPager").height() - 38;
                      tbHeight = tbHeight < 300 ? 300 : tbHeight
                      $("#tb").H8_Grid($("#divPager"), tbHeight);
                  }, PageSize, true);


                  $('#btn_search').click(function () {
                      pager.option.pageIndex = 1;
                      pager.getPegerData();
                      return false;
                  });

                  $("#ownShop").MgrShopSelect(AppPath, shops);
              });
              

              function exportExcel(){
                    $("#btn_serach").click();
                    var v = $('div.search').gform();
                    v.ActionName = "GetSwingCard";
                    v.searchItem = $('#dropSearchItem').val();
                    v.matchWay = $('#dropMatchWay').val();
                    v.keyword =$('#txt_keyword').val();
                    v.dateStart =$('#txt_CREATE_START').val();
                    v.dateEnd =$('#txt_CREATE_END').val();
                    v.ownShop =$.FxNull($("#ownShop").attr("codes"), "");
                    v.isExport="1";
                    $.formP(handler, v);              
               }


              function deleteSwing(pk) {
                  if (!confirm("确认删除吗?"))
                     return false;

                  $.post(handler, { ActionName: "DeleteSwingCard", pk: pk },
                   function (rslt) {
                       if (rslt.MessageCode == "Ok") {
                           $("tr[key='" + pk + "']").remove();
                           alert("删除成功."); return;
                       }
                   }
                , "json");
              }
      </script>
</head>
<body>
      <div class="warrper_body">  
         <div class="index" style=" overflow:hidden">
            <div class="common_search">
                 <div class="l_h45">  
                    查询项：
                      <select id="dropSearchItem">
                           <option selected value="CARD_NO">卡号</option>
                           <option value="NAME">姓名</option>
                           <option value="MOBILE">手机号</option>
                           <option value="TYPE">录入类型</option>
                           <option value="ACCOUNT">操作员</option>
                     </select>
                     <select id="dropMatchWay" style=" width:35px">
                         <option selected value="=">=</option>
                         <option value="包含">包含</option>
                     </select>
                     <input type="text" id="txt_keyword" value="" />
                     体验日期：<input id="txt_CREATE_START" style="width: 100px" type="text" onfocus="WdatePicker()" />
                    至<input id="txt_CREATE_END" style="width: 100px" type="text" onfocus="WdatePicker()" />
                    <span class="mr30 mb20">所属店铺：
                        <input type="button" id="ownShop" class="common_btn_gaoji115" />
                    </span>

                    <span class="mr30"><input name="" id="btn_search" type="button"  class="common_btn_search"/></span>
                    <span class="mr30"><input name="" id="btn_export" type="button" value="导出Excel" onclick="exportExcel()" class="export_excel"/></span>
                 </div>
            </div>
            <div class="l_h7"></div>
           
            <div class="index_table">
                <table id="tb" class="common_table">
                    <thead>
                        <tr>
                            <th width="80px" orderaction="false">操作</th>
                            <th width="100px" ordertype="string">卡号</th>
                            <th width="100px" ordertype="string">姓名</th>
                            <th width="110px" ordertype="string">手机号</th>
                            <th width="100px" ordertype="string">录入类型</th>
                            <th width="100px" ordertype="string">体验时间</th>
                            <th width="80px" ordertype="string">本次积分</th>
                           <%-- <th width="80px" ordertype="string">体验总积分</th>--%>
                            <th width="80px" ordertype="string">操作员</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="9" style="text-align: center">点击搜索查看数据</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="page" id="divPager"></div>      
        </div>
     </div> 
</body>
</html>
